package com.aidong.carnival.entity;

import java.util.ArrayList;
import java.util.List;

import com.aidong.carnival.controllers.concerns.View.Base;
import com.aidong.carnival.controllers.concerns.View.WithPhoto;
import com.aidong.carnival.controllers.concerns.View.WithPhotoList;
import com.aidong.carnival.controllers.concerns.View.WithVotedList;
import com.aidong.util.QiniuUtil;
import com.fasterxml.jackson.annotation.JsonView;

public class Talent {
	private int carnivalId;
	@JsonView(Base.class)
	private String type;
	@JsonView(Base.class)
	private int idongId;
	@JsonView(Base.class)
	private String name;
	private String avatar;
	@JsonView(Base.class)
	private int vote;
	@JsonView(WithPhotoList.class)
	private List<Photo> photoList;
	@JsonView(WithVotedList.class)
	private List<VotedTalent> voted;
	private String defaultPhoto;

	public Talent() {
	}

	public Talent(int carnivalId, int idongId, String type, String defaultPhoto) {
		this.carnivalId = carnivalId;
		this.idongId = idongId;
		this.type = type;
		this.defaultPhoto = defaultPhoto;
	}

	@JsonView(Base.class)
	public String avatar() {
		if(avatar==null){
			return "";
		}else{
			return QiniuUtil.QINIU_URL + avatar;	
		}
		
	}

	public int getCarnivalId() {
		return carnivalId;
	}

	public void setCarnivalId(int carnivalId) {
		this.carnivalId = carnivalId;
	}

	public String getType() {
		if(type==null){
			type="";
		}
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@JsonView(WithPhoto.class)
	public String photo() {
		if(defaultPhoto==null){
			return "";
		}else{
			return QiniuUtil.QINIU_URL + defaultPhoto;	
		}
		
	}

	public String getDefaultPhoto() {
		return defaultPhoto;
	}

	public void setDefaultPhoto(String defaultPhoto) {
		this.defaultPhoto = defaultPhoto;
	}

	public int getIdongId() {
		return idongId;
	}

	public void setIdongId(int idongId) {
		this.idongId = idongId;
	}

	public String getName() {
		if(name==null){
			name = "";
		}
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAvatar() {
		return avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	public int getVote() {
		return vote;
	}

	public void setVote(int vote) {
		this.vote = vote;
	}

	public List<Photo> getPhotoList() {
		if(photoList == null){
			photoList = new ArrayList<Photo>();
		}
		return photoList;
	}

	public void setPhotoList(List<Photo> photoList) {
		this.photoList = photoList;
	}

	public List<VotedTalent> getVoted() {
		if(voted == null){
			voted = new ArrayList<VotedTalent>();
		}
		return voted;
	}

	public void setVoted(List<VotedTalent> voted) {
		this.voted = voted;
	}

}
